home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / clang / fgl105c.zip / 10-02.C < prev    next >
Text File  |  1991-05-05  |  780b  |  37 lines

  1. main()
  2. {
  3.    int new_mode, old_mode;
  4.    int x;
  5.  
  6.    /* initialize the video environment */
  7.  
  8.    new_mode = fg_bestmode(320,200,1);
  9.    if (new_mode < 0 || new_mode == 12) {
  10.       printf("This program requires a 320 ");
  11.       printf("x 200 color graphics mode.\n");
  12.       exit();
  13.       }
  14.    old_mode = fg_getmode();
  15.    fg_setmode(new_mode);
  16.  
  17.    /* draw some type of background */
  18.  
  19.    fg_setcolor(15);
  20.    fg_rect(0,319,0,199);
  21.  
  22.    /* move the object across the screen */
  23.  
  24.    for (x = -20; x < 320; x+=5) {
  25.       fg_setcolor(10);
  26.       fg_clprect(x,x+19,95,104);
  27.       fg_waitfor(1);
  28.       fg_setcolor(0);
  29.       fg_clprect(x,x+19,95,104);
  30.       }
  31.  
  32.    /* restore the original video mode and return to DOS */
  33.  
  34.    fg_setmode(old_mode);
  35.    fg_reset();
  36. }
  37.